<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>波仔的学习之旅-3</title>
</head>

<body>
  <div class="data">
    <!-- 2.上页应让i--从而改变下标渲染页面 -->
    <!-- 4.当页面为第一张图片时 上一页隐藏 -->
    <button v-on:click="i--" v-show="i>0">上一页</button>
    <div>
      <img v-bind:src="list[i]" alt="">
    </div>
     <!-- 3.上页应让i++从而改变下标渲染页面 -->
     <!-- 5.当页面为最后一张图片时 下一页隐藏 -->
    <button v-on:click="i++" v-show="i<list.length-1">下一页</button>
  </div>
  <script src="vue.js"></script>
  <script>
    const app = new Vue({
      el: '.data',
      data: {
        // 1.默认下标为0 显示第一张图片
        i:0,
        list: [
          './imgs/11-00.gif',
          './imgs/11-01.gif',
          './imgs/11-02.gif',
          './imgs/11-03.gif',
          './imgs/11-04.png',
          './imgs/11-05.png',
        ]
      }
    })
  </script>
</body>

</html>